<template>
  <div class="order_info">
    <div class="order_info_top">我想要咨询这笔订单</div>
    <div class="message_order_pro">
      <div class="message_order_pro_item" v-for="(pro,i) in orderInfo.pro" :key="i">
        <img :src="$fnc.getImgUrl(pro.piclink)" mode="aspectFill" />
        <div class="">
          <span>{{pro.title}}</span>
          <span>共{{pro.number}}件商品 合计￥{{$fnc.toFixedZ(pro.price)}}</span>
        </div>
      </div>
    </div>
    <div class="message_order_info">
      <div>
        <span>订单：</span>
        <span>{{orderInfo.oid}}</span>
      </div>
      <div>
        <span>实付款：</span>
        <span>￥{{ $fnc.toFixedZ(orderInfo.money)}}</span>
      </div>
      <div>
        <span>创建时间：</span>
        <span>{{ orderInfo.created_time | getTimeFormat }}</span>
      </div>
    </div>
    <div class="message_order_btn">
      <el-button size="mini" type="primary" round @click="gotoOrder(orderInfo.oid)">查看订单</el-button>
    </div>
  </div>
</template>

<script>
import { Image } from "vant";
export default {
  name: "team-yq",
  props: {
    orderInfo: {
      type: Object,
      default: () => {},
    },
  },
  data() {
    return {};
  },
  components: {
    [Image.name]: Image,
  },
  created() {},
  mounted() {},
  methods: {
    gotoOrder(oid) {
      this.$api.getUser.getOrderList({ oid: oid }).then((res) => {
        if (
          res.data.code == 200 &&
          res.data.result.data &&
          res.data.result.data[0]
        ) {
          let routeData = this.$router.resolve({
            path: "/index/order/addorder",
            query: { id: res.data.result.data[0].id },
          });
          window.open(routeData.href, "_blank");
        } else {
          params.is_supplier = 1;
          this.$api.getUser
            .getOrderList({ oid: oid, is_supplier: 1 })
            .then((res2) => {
              if (
                res2.data.code == 200 &&
                res2.data.result.data &&
                res2.data.result.data[0]
              ) {
                let routeData = this.$router.resolve({
                  path: "/index/order/addorder",
                  query: { id: res2.data.result.data[0].id },
                });
                window.open(routeData.href, "_blank");
              }
            });
        }
      });
    },
  },
};
</script>
<style lang='less' scoped>
.order_info {
  width: 480px;
  background-color: #fff;
  padding: 10px;
  border-radius: 5px;
  .order_info_top {
    font-size: 16px;
    font-weight: 400;
    color: #000;
    text-align: left;
  }

  .message_order_pro {
    width: 100%;

    .message_order_pro_item {
      width: 100%;
      display: flex;
      justify-content: flex-start;
      align-items: center;

      padding: 5px;
      border-radius: 10px;
      background-color: #f8f8f8;
      margin: 10px 0 0 0;

      > img {
        width: 50px;
        height: 50px;
        margin-right: 5px;
      }

      > div {
        font-size: 12px;
        color: #333;
        flex: 1;
        overflow: hidden;
        display: flex;
        flex-flow: column;
        justify-content: space-between;
        align-items: flex-start;
        > span:nth-of-type(1) {
          font-size: 14px;
          font-weight: 500;
        }
      }
    }
  }

  .message_order_info {
    width: 100%;
    margin-top: 10px;

    > div {
      width: 100%;
      display: flex;
      justify-content: space-between;
      align-items: center;

      font-size: 14px;
      line-height: 28px;
      color: #333;
    }
  }
  .message_order_btn {
    width: 100%;
    display: flex;
    justify-content: flex-end;
    align-items: center;
    margin-top: 10px;
  }
}
</style>
